﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Azad;
using Azad.BCL;
using NazSoft.Framework;

public partial class NewsPopup : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        var collection = Request.QueryString;
        var newsid = collection["nid"].ToInt32Safe();
        var detailid = collection["did"].ToInt32Safe();
        var sequence = collection["s"].ToInt32Safe();
        SilverlightService silverlightService = new SilverlightService();
        var today = DateTimeUtilities.GetDateFromQueryString(collection);

        var logoInfo = silverlightService.Get(newsid);
        if (logoInfo != null)
        {
            BCL.Entity.LogoDetailDetail detail = null;


            foreach (var item in logoInfo.Detail)
            {
                detail = item.DetailToDetail.Where(x => x.Id == detailid ).FirstOrDefault();

                if (detail != null)
                {
                    break;
                }
            }

            if (detail != null)
            {
                NewsImage.ImageUrl = detail.FileName;
                NewsImage.AlternateText = detail.Description;
                NewsImage.ToolTip = detail.Description;
            }
        }
    }
}